﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ec_System.API;

namespace Ec_System.WebUI
{
    public class CustomExceptionFilter : HandleErrorAttribute
    {
        public override void OnException(ExceptionContext filterContext)
        {
            //如果异常未处理
            if(! filterContext.ExceptionHandled)
            {
                Exception innerException = filterContext.Exception;
                var userName = filterContext.HttpContext.User.Identity;

                //记录异常
                Log4netHelper.InvokeErrorLog(innerException.GetType(), innerException.Message, innerException);

            }

            base.OnException(filterContext);
        }
    }
}